define(function (require) {
    var angular = require("angular");
    angular
        .module('parameter', [
		])
        .factory('url', [
            function () {
                return {
                    //给url添加search字符串
                    addParam: function (url, search) {
                        for (var key in search) {
                            if (search.hasOwnProperty(key) && search[key]) {
                                var connecter = "&";
                                if (url.indexOf('?') === -1) {
                                    connecter = "?";
                                }
                                url += connecter + key + '=' + encodeURIComponent(search[key]);
                            }
                        }
                        return url;
                    },
                    getParam: function (url,param){
                        var query = {};
                        
                        url.replace(/[?&#]([^=]+)=([^&#$]+)/g,function(str,key,val){
                            query[key] = val;
                        });
                        
                        return query[param];
                    }
                };
            }
        ])
        
        .controller('ConfigEffectController', [
            '$scope',
            'url',
            function ($scope,url) {
				var type = url.getParam(location.href,'type');
				$scope.type = type || 'rgkj';
            }
        ])

    angular.element(document).ready(function () {
        angular.bootstrap(document, ['parameter']);
    });
});
